//
//  NewFeatureCollectionViewController.m
//  Weibo
//
//  Created by student on 16/5/3.
//  Copyright © 2016年 Mcc. All rights reserved.
//

#import "NewFeatureCollectionViewController.h"
#import "NewFeatureCell.h"

@interface NewFeatureCollectionViewController()


@end

@implementation NewFeatureCollectionViewController

static NSString * const reuseIdentifier=@"Cell";

-(void)viewDidLoad
{
    [super viewDidLoad];
    
    //单元格模板
    [self.collectionView registerClass:[NewFeatureCell class] forCellWithReuseIdentifier:reuseIdentifier];
    
    //调整CollectionView的布局
    UICollectionViewFlowLayout *fl=[[UICollectionViewFlowLayout alloc]init];
    //大小
    fl.itemSize=[UIScreen mainScreen].bounds.size;
    //方向
    fl.scrollDirection=UICollectionViewScrollDirectionHorizontal;
    //Cell之间的间距
    fl.minimumLineSpacing=0;//段之间
    fl.minimumInteritemSpacing=0;//项之间
    
    self.collectionView.collectionViewLayout=fl;
    
     // collectionView设置
    // 关闭边界空隙
    self.collectionView.bounces=NO;
      // 不显示滑动条
    self.collectionView.showsHorizontalScrollIndicator=NO;
      // 分页
    self.collectionView.pagingEnabled=YES;
}

#pragma mark <UIColleCtionViewDataSource>

//有几项内容
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 4;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    NewFeatureCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    cell.imageIndex=indexPath.row;
    return cell;
}
@end
